#include "quadrature.hpp"
#include "../io/alelib_tags.hpp"
#include <cstdio>
#include "../util/assert.hpp"
#include <cmath>

namespace alelib
{


Quadrature::Quadrature(ECellType ct, int degree)
{
  setType(ct,degree);
}

/// 
/// @param n order.
/// @param dim hypercube's dimension.
/// @param[out] points qdrts points.
/// @param[out] weights qdrts weights.
/// @param[out] nm_qpoints num of points.
/// 
void Quadrature::igetQuadrPtsHypercube(int n, int dim, std::vector<Vec3>& points, std::vector<Real>& weights)
{

  std::vector<Real> points_1d(n/2 + 1);
  std::vector<Real> weights_1d(n/2 + 1);

  // integra exatamente polinomios de grau (num_pts*2 - 1)
  if ( (n >= 0) && (n <= 1) )
  {
    points_1d[0] = 0.0L; weights_1d[0] = 2.000000000000000000L;
  }
  else

  if ( (n >= 2) && (n <= 3) )
  {
    points_1d[0] = -5.773502691896258e-1L; weights_1d[0] = 1.000000000000000000L;
    points_1d[1] = +5.773502691896258e-1L; weights_1d[1] = 1.000000000000000000L;
  }
  else

  if ( (n >= 4) && (n <= 5) )
  {
    points_1d[0] = 0.000000000000000000L; weights_1d[0] = 8.888888888888889e-1L;
    points_1d[1] = +7.745966692414834e-1; weights_1d[1] = 5.555555555555556e-1L;
    points_1d[2] = -7.745966692414834e-1; weights_1d[2] = 5.555555555555556e-1L;
  }
  else

  if ( (n >= 6) && (n <= 7) )
  {
    points_1d[0] = +3.399810435848563e-1L; weights_1d[0] = 6.521451548625462e-1L;
    points_1d[1] = -3.399810435848563e-1L; weights_1d[1] = 6.521451548625462e-1L;
    points_1d[2] = +8.611363115940526e-1L; weights_1d[2] = 3.478548451374539e-1L;
    points_1d[3] = -8.611363115940526e-1L; weights_1d[3] = 3.478548451374539e-1L;
  }
  else

  if ( (n >= 8) && (n <= 9) )
  {
    points_1d[0] = +0.000000000000000000L; weights_1d[0] = 5.688888888888889e-1L;
    points_1d[1] = +5.384693101056831e-1L; weights_1d[1] = 4.786286704993665e-1L;
    points_1d[2] = -5.384693101056831e-1L; weights_1d[2] = 4.786286704993665e-1L;
    points_1d[3] = +9.06179845938664e-1L;  weights_1d[3] = 2.369268850561891e-1L;
    points_1d[4] = -9.06179845938664e-1L;  weights_1d[4] = 2.369268850561891e-1L;
  }
  else
  {
    ALELIB_CHECK(false, "invalid or not supported quadrature order", std::invalid_argument);
  }

  points.resize (pow(points_1d.size(),dim));
  weights.resize(pow(points_1d.size(),dim));

  int I[3] = {0,0,0}; // max dim = 3

  // cartesian product
  for (int s = 0; s < (int)points.size(); ++s)
  {
    weights[s] = 1;//weights_1d[s];
    for (int c = 0; c < dim; ++c)
    {
      weights[s] *= weights_1d[I[c]];
      points[s][c] = points_1d[I[c]];
    }

    for (int c = 0; c < dim; ++c)
    {
      ++I[c];
      if (I[c] != (int)points_1d.size())
        break;
      else
        I[c] = 0;
    }

  }


}


void Quadrature::setType(ECellType ct, int degree)
{
  this->m_degree = degree;

  switch (ct)
  {
    case POINT:
    {
      m_qpoints.resize(1);
      m_weights.resize(1);
      m_qpoints[0][0] = 0;
      m_weights[0] = 1.0L;
    }
    break;

    case EDGE:
      igetQuadrPtsHypercube(degree, 1, m_qpoints, m_weights);
    break;

    case QUADRANGLE:
      igetQuadrPtsHypercube(degree, 2, m_qpoints, m_weights);
    break;

    case HEXAHEDRON:
      igetQuadrPtsHypercube(degree, 3, m_qpoints, m_weights);
    break;

    case TRIANGLE:
    {
      int const n = degree;
      if ( (n >= 0) && (n <= 1) )
      {
        m_qpoints.resize (1);
        m_weights.resize(1);
        m_qpoints[0][0] = 0.333333333333333333L; m_qpoints[0][1] = 0.333333333333333333L; m_weights[0] = 1.000000000000000000L;
      }
      else

      if (n == 2)
      {
        m_qpoints.resize (3);
        m_weights.resize(3);
        m_qpoints[0][0] = 0.166666666666666667L; m_qpoints[0][1] = 0.166666666666666667L;  m_weights[0] = 0.333333333333333333L;
        m_qpoints[1][0] = 0.166666666666666667L; m_qpoints[1][1] = 0.666666666666666667L;  m_weights[1] = 0.333333333333333333L;
        m_qpoints[2][0] = 0.666666666666666667L; m_qpoints[2][1] = 0.166666666666666667L;  m_weights[2] = 0.333333333333333333L;
      }
      else

      if (n == 3)
      {
        m_qpoints.resize (6);
        m_weights.resize(6);
        m_qpoints[0][0] = 0.445948490915964886L; m_qpoints[0][1] = 0.445948490915964886L;  m_weights[0] = 0.223381589678011466L;
        m_qpoints[1][0] = 0.445948490915964886L; m_qpoints[1][1] = 0.108103018168070227L;  m_weights[1] = 0.223381589678011466L;
        m_qpoints[2][0] = 0.108103018168070227L; m_qpoints[2][1] = 0.445948490915964886L;  m_weights[2] = 0.223381589678011466L;
        m_qpoints[3][0] = 0.091576213509770743L; m_qpoints[3][1] = 0.091576213509770743L;  m_weights[3] = 0.109951743655321868L;
        m_qpoints[4][0] = 0.091576213509770743L; m_qpoints[4][1] = 0.816847572980458513L;  m_weights[4] = 0.109951743655321868L;
        m_qpoints[5][0] = 0.816847572980458513L; m_qpoints[5][1] = 0.091576213509770743L;  m_weights[5] = 0.109951743655321868L;
      }
      else

      if ( (n >= 4) && (n <= 5) )
      {
        m_qpoints.resize (7);
        m_weights.resize(7);
        m_qpoints[0][0] = 0.101286507323456339L; m_qpoints[0][1] = 0.101286507323456339L;  m_weights[0] = 0.125939180544827153L;
        m_qpoints[1][0] = 0.101286507323456339L; m_qpoints[1][1] = 0.797426985353087322L;  m_weights[1] = 0.125939180544827153L;
        m_qpoints[2][0] = 0.797426985353087322L; m_qpoints[2][1] = 0.101286507323456339L;  m_weights[2] = 0.125939180544827153L;
        m_qpoints[3][0] = 0.470142064105115090L; m_qpoints[3][1] = 0.470142064105115090L;  m_weights[3] = 0.132394152788506181L;
        m_qpoints[4][0] = 0.470142064105115090L; m_qpoints[4][1] = 0.059715871789769820L;  m_weights[4] = 0.132394152788506181L;
        m_qpoints[5][0] = 0.059715871789769820L; m_qpoints[5][1] = 0.470142064105115090L;  m_weights[5] = 0.132394152788506181L;
        m_qpoints[6][0] = 0.333333333333333333L; m_qpoints[6][1] = 0.333333333333333333L;  m_weights[6] = 0.225000000000000000L;
      }
      else

      if (n == 6)
      {
        m_qpoints.resize (12);
        m_weights.resize(12);
        m_qpoints[0][0] = 0.063089014491502228L; m_qpoints[0][1] = 0.063089014491502228L;  m_weights[0] = 0.050844906370206817L;
        m_qpoints[1][0] = 0.063089014491502228L; m_qpoints[1][1] = 0.873821971016995543L;  m_weights[1] = 0.050844906370206817L;
        m_qpoints[2][0] = 0.873821971016995543L; m_qpoints[2][1] = 0.063089014491502228L;  m_weights[2] = 0.050844906370206817L;
        m_qpoints[3][0] = 0.249286745170910421L; m_qpoints[3][1] = 0.249286745170910421L;  m_weights[3] = 0.116786275726379366L;
        m_qpoints[4][0] = 0.249286745170910421L; m_qpoints[4][1] = 0.501426509658179157L;  m_weights[4] = 0.116786275726379366L;
        m_qpoints[5][0] = 0.501426509658179157L; m_qpoints[5][1] = 0.249286745170910421L;  m_weights[5] = 0.116786275726379366L;
        m_qpoints[6][0] = 0.053145049844816947L; m_qpoints[6][1] = 0.310352451033784405L;  m_weights[6] = 0.082851075618373575L;
        m_qpoints[7][0] = 0.053145049844816947L; m_qpoints[7][1] = 0.636502499121398647L;  m_weights[7] = 0.082851075618373575L;
        m_qpoints[8][0] = 0.310352451033784405L; m_qpoints[8][1] = 0.053145049844816947L;  m_weights[8] = 0.082851075618373575L;
        m_qpoints[9][0] = 0.310352451033784405L; m_qpoints[9][1] = 0.636502499121398647L;  m_weights[9] = 0.082851075618373575L;
        m_qpoints[10][0] = 0.636502499121398647L; m_qpoints[10][1] = 0.053145049844816947L;  m_weights[10] = 0.082851075618373575L;
        m_qpoints[11][0] = 0.636502499121398647L; m_qpoints[11][1] = 0.310352451033784405L;  m_weights[11] = 0.082851075618373575L;
      }
      else

      if (n == 7)
      {
        m_qpoints.resize (15);
        m_weights.resize(15);
        m_qpoints[0][0] = 0.028263924156076340L; m_qpoints[0][1] = 0.028263924156076340L;  m_weights[0] = 0.013533862515665562L;
        m_qpoints[1][0] = 0.028263924156076340L; m_qpoints[1][1] = 0.943472151687847320L;  m_weights[1] = 0.013533862515665562L;
        m_qpoints[2][0] = 0.943472151687847320L; m_qpoints[2][1] = 0.028263924156076340L;  m_weights[2] = 0.013533862515665562L;
        m_qpoints[3][0] = 0.474311323267222575L; m_qpoints[3][1] = 0.474311323267222575L;  m_weights[3] = 0.078951254432010981L;
        m_qpoints[4][0] = 0.474311323267222575L; m_qpoints[4][1] = 0.051377353465554849L;  m_weights[4] = 0.078951254432010981L;
        m_qpoints[5][0] = 0.051377353465554849L; m_qpoints[5][1] = 0.474311323267222575L;  m_weights[5] = 0.078951254432010981L;
        m_qpoints[6][0] = 0.241143325849848810L; m_qpoints[6][1] = 0.241143325849848810L;  m_weights[6] = 0.128607927818906075L;
        m_qpoints[7][0] = 0.241143325849848810L; m_qpoints[7][1] = 0.517713348300302379L;  m_weights[7] = 0.128607927818906075L;
        m_qpoints[8][0] = 0.517713348300302379L; m_qpoints[8][1] = 0.241143325849848810L;  m_weights[8] = 0.128607927818906075L;
        m_qpoints[9][0] = 0.761222748024523800L; m_qpoints[9][1] = 0.046270877798808911L;  m_weights[9] = 0.056120144283375358L;
        m_qpoints[10][0] = 0.761222748024523800L; m_qpoints[10][1] = 0.192506374176667289L;  m_weights[10] = 0.056120144283375358L;
        m_qpoints[11][0] = 0.046270877798808911L; m_qpoints[11][1] = 0.761222748024523800L;  m_weights[11] = 0.056120144283375358L;
        m_qpoints[12][0] = 0.046270877798808911L; m_qpoints[12][1] = 0.192506374176667289L;  m_weights[12] = 0.056120144283375358L;
        m_qpoints[13][0] = 0.192506374176667289L; m_qpoints[13][1] = 0.761222748024523800L;  m_weights[13] = 0.056120144283375358L;
        m_qpoints[14][0] = 0.192506374176667289L; m_qpoints[14][1] = 0.046270877798808911L;  m_weights[14] = 0.056120144283375358L;
      }
      else

      if (n == 8)
      {
        m_qpoints.resize (16);
        m_weights.resize(16);
        m_qpoints[0][0] = 0.333333333333333333L; m_qpoints[0][1] = 0.333333333333333333L;  m_weights[0] = 0.144315607677787168L;
        m_qpoints[1][0] = 0.170569307751760207L; m_qpoints[1][1] = 0.170569307751760207L;  m_weights[1] = 0.103217370534718250L;
        m_qpoints[2][0] = 0.170569307751760207L; m_qpoints[2][1] = 0.658861384496479587L;  m_weights[2] = 0.103217370534718250L;
        m_qpoints[3][0] = 0.658861384496479587L; m_qpoints[3][1] = 0.170569307751760207L;  m_weights[3] = 0.103217370534718250L;
        m_qpoints[4][0] = 0.050547228317030975L; m_qpoints[4][1] = 0.050547228317030975L;  m_weights[4] = 0.032458497623198080L;
        m_qpoints[5][0] = 0.050547228317030975L; m_qpoints[5][1] = 0.898905543365938049L;  m_weights[5] = 0.032458497623198080L;
        m_qpoints[6][0] = 0.898905543365938049L; m_qpoints[6][1] = 0.050547228317030975L;  m_weights[6] = 0.032458497623198080L;
        m_qpoints[7][0] = 0.459292588292723156L; m_qpoints[7][1] = 0.459292588292723156L;  m_weights[7] = 0.095091634267284625L;
        m_qpoints[8][0] = 0.459292588292723156L; m_qpoints[8][1] = 0.081414823414553688L;  m_weights[8] = 0.095091634267284625L;
        m_qpoints[9][0] = 0.081414823414553688L; m_qpoints[9][1] = 0.459292588292723156L;  m_weights[9] = 0.095091634267284625L;
        m_qpoints[10][0] = 0.263112829634638113L; m_qpoints[10][1] = 0.008394777409957605L;  m_weights[10] = 0.027230314174434994L;
        m_qpoints[11][0] = 0.263112829634638113L; m_qpoints[11][1] = 0.728492392955404281L;  m_weights[11] = 0.027230314174434994L;
        m_qpoints[12][0] = 0.008394777409957605L; m_qpoints[12][1] = 0.263112829634638113L;  m_weights[12] = 0.027230314174434994L;
        m_qpoints[13][0] = 0.008394777409957605L; m_qpoints[13][1] = 0.728492392955404281L;  m_weights[13] = 0.027230314174434994L;
        m_qpoints[14][0] = 0.728492392955404281L; m_qpoints[14][1] = 0.263112829634638113L;  m_weights[14] = 0.027230314174434994L;
        m_qpoints[15][0] = 0.728492392955404281L; m_qpoints[15][1] = 0.008394777409957605L;  m_weights[15] = 0.027230314174434994L;
      }
      else

      if (n == 9)
      {
        m_qpoints.resize (19);
        m_weights.resize(19);
        m_qpoints[0][0] = 0.333333333333333333L; m_qpoints[0][1] = 0.333333333333333333L;  m_weights[0] = 0.097135796282798834L;
        m_qpoints[1][0] = 0.489682519198737628L; m_qpoints[1][1] = 0.489682519198737628L;  m_weights[1] = 0.031334700227139071L;
        m_qpoints[2][0] = 0.489682519198737628L; m_qpoints[2][1] = 0.020634961602524744L;  m_weights[2] = 0.031334700227139071L;
        m_qpoints[3][0] = 0.020634961602524744L; m_qpoints[3][1] = 0.489682519198737628L;  m_weights[3] = 0.031334700227139071L;
        m_qpoints[4][0] = 0.044729513394452710L; m_qpoints[4][1] = 0.044729513394452710L;  m_weights[4] = 0.025577675658698031L;
        m_qpoints[5][0] = 0.044729513394452710L; m_qpoints[5][1] = 0.910540973211094580L;  m_weights[5] = 0.025577675658698031L;
        m_qpoints[6][0] = 0.910540973211094580L; m_qpoints[6][1] = 0.044729513394452710L;  m_weights[6] = 0.025577675658698031L;
        m_qpoints[7][0] = 0.437089591492936637L; m_qpoints[7][1] = 0.437089591492936637L;  m_weights[7] = 0.077827541004774279L;
        m_qpoints[8][0] = 0.437089591492936637L; m_qpoints[8][1] = 0.125820817014126725L;  m_weights[8] = 0.077827541004774279L;
        m_qpoints[9][0] = 0.125820817014126725L; m_qpoints[9][1] = 0.437089591492936637L;  m_weights[9] = 0.077827541004774279L;
        m_qpoints[10][0] = 0.188203535619032730L; m_qpoints[10][1] = 0.188203535619032730L;  m_weights[10] = 0.079647738927210253L;
        m_qpoints[11][0] = 0.188203535619032730L; m_qpoints[11][1] = 0.623592928761934540L;  m_weights[11] = 0.079647738927210253L;
        m_qpoints[12][0] = 0.623592928761934540L; m_qpoints[12][1] = 0.188203535619032730L;  m_weights[12] = 0.079647738927210253L;
        m_qpoints[13][0] = 0.741198598784498021L; m_qpoints[13][1] = 0.221962989160765696L;  m_weights[13] = 0.043283539377289377L;
        m_qpoints[14][0] = 0.741198598784498021L; m_qpoints[14][1] = 0.036838412054736284L;  m_weights[14] = 0.043283539377289377L;
        m_qpoints[15][0] = 0.221962989160765696L; m_qpoints[15][1] = 0.741198598784498021L;  m_weights[15] = 0.043283539377289377L;
        m_qpoints[16][0] = 0.221962989160765696L; m_qpoints[16][1] = 0.036838412054736284L;  m_weights[16] = 0.043283539377289377L;
        m_qpoints[17][0] = 0.036838412054736284L; m_qpoints[17][1] = 0.741198598784498021L;  m_weights[17] = 0.043283539377289377L;
        m_qpoints[18][0] = 0.036838412054736284L; m_qpoints[18][1] = 0.221962989160765696L;  m_weights[18] = 0.043283539377289377L;

      }
      else

      if (n == 10)
      {
        m_qpoints.resize (25);
        m_weights.resize(25);
        m_qpoints[0][0] = 0.333333333333333333L; m_qpoints[0][1] = 0.333333333333333333L;  m_weights[0] = 0.080937428797622880L;
        m_qpoints[1][0] = 0.427273178846775538L; m_qpoints[1][1] = 0.427273178846775538L;  m_weights[1] = 0.077298588002963122L;
        m_qpoints[2][0] = 0.427273178846775538L; m_qpoints[2][1] = 0.145453642306448924L;  m_weights[2] = 0.077298588002963122L;
        m_qpoints[3][0] = 0.145453642306448924L; m_qpoints[3][1] = 0.427273178846775538L;  m_weights[3] = 0.077298588002963122L;
        m_qpoints[4][0] = 0.183099222448675021L; m_qpoints[4][1] = 0.183099222448675021L;  m_weights[4] = 0.078457638612371731L;
        m_qpoints[5][0] = 0.183099222448675021L; m_qpoints[5][1] = 0.633801555102649959L;  m_weights[5] = 0.078457638612371731L;
        m_qpoints[6][0] = 0.633801555102649959L; m_qpoints[6][1] = 0.183099222448675021L;  m_weights[6] = 0.078457638612371731L;
        m_qpoints[7][0] = 0.490434019701130587L; m_qpoints[7][1] = 0.490434019701130587L;  m_weights[7] = 0.017469167995929487L;
        m_qpoints[8][0] = 0.490434019701130587L; m_qpoints[8][1] = 0.019131960597738825L;  m_weights[8] = 0.017469167995929487L;
        m_qpoints[9][0] = 0.019131960597738825L; m_qpoints[9][1] = 0.490434019701130587L;  m_weights[9] = 0.017469167995929487L;
        m_qpoints[10][0] = 0.012572445551580533L; m_qpoints[10][1] = 0.012572445551580533L;  m_weights[10] = 0.004292374184832828L;
        m_qpoints[11][0] = 0.012572445551580533L; m_qpoints[11][1] = 0.974855108896838935L;  m_weights[11] = 0.004292374184832828L;
        m_qpoints[12][0] = 0.974855108896838935L; m_qpoints[12][1] = 0.012572445551580533L;  m_weights[12] = 0.004292374184832828L;
        m_qpoints[13][0] = 0.654268667920066141L; m_qpoints[13][1] = 0.308046001685247706L;  m_weights[13] = 0.037468858210467643L;
        m_qpoints[14][0] = 0.654268667920066141L; m_qpoints[14][1] = 0.037685330394686154L;  m_weights[14] = 0.037468858210467643L;
        m_qpoints[15][0] = 0.308046001685247706L; m_qpoints[15][1] = 0.654268667920066141L;  m_weights[15] = 0.037468858210467643L;
        m_qpoints[16][0] = 0.308046001685247706L; m_qpoints[16][1] = 0.037685330394686154L;  m_weights[16] = 0.037468858210467643L;
        m_qpoints[17][0] = 0.037685330394686154L; m_qpoints[17][1] = 0.654268667920066141L;  m_weights[17] = 0.037468858210467643L;
        m_qpoints[18][0] = 0.037685330394686154L; m_qpoints[18][1] = 0.308046001685247706L;  m_weights[18] = 0.037468858210467643L;
        m_qpoints[19][0] = 0.122804577068559273L; m_qpoints[19][1] = 0.033371833739304788L;  m_weights[19] = 0.026949352591879960L;
        m_qpoints[20][0] = 0.122804577068559273L; m_qpoints[20][1] = 0.843823589192135939L;  m_weights[20] = 0.026949352591879960L;
        m_qpoints[21][0] = 0.033371833739304788L; m_qpoints[21][1] = 0.122804577068559273L;  m_weights[21] = 0.026949352591879960L;
        m_qpoints[22][0] = 0.033371833739304788L; m_qpoints[22][1] = 0.843823589192135939L;  m_weights[22] = 0.026949352591879960L;
        m_qpoints[23][0] = 0.843823589192135939L; m_qpoints[23][1] = 0.122804577068559273L;  m_weights[23] = 0.026949352591879960L;
        m_qpoints[24][0] = 0.843823589192135939L; m_qpoints[24][1] = 0.033371833739304788L;  m_weights[24] = 0.026949352591879960L;
      }
      else
      {
        ALELIB_CHECK(false, "invalid or not supported quadrature order", std::invalid_argument);
      }
      for (int i = 0; i < (int)m_weights.size(); ++i)
        m_weights[i] /= 2.0L;      
    }
    break;

    case TETRAHEDRON:
    {
      int const n = degree;
      if ( (n >= 0) && (n <= 1) )
      {
        m_qpoints.resize (1);
        m_weights.resize(1);
        m_qpoints[0][0] = 0.25L; m_qpoints[0][1] = 0.25L; m_qpoints[0][2] = 0.25L; m_weights[0] = 1.000000000000000000L;
      }
      else
      if (n == 2)
      {
        m_qpoints.resize (4);
        m_weights.resize(4);
        m_qpoints[0][0] = 0.138196601125010515L; m_qpoints[0][1] = 0.138196601125010515L; m_qpoints[0][2] = 0.138196601125010515L;  m_weights[0] = 0.250000000000000000L;
        m_qpoints[1][0] = 0.138196601125010515L; m_qpoints[1][1] = 0.138196601125010515L; m_qpoints[1][2] = 0.585410196624968454L;  m_weights[1] = 0.250000000000000000L;
        m_qpoints[2][0] = 0.138196601125010515L; m_qpoints[2][1] = 0.585410196624968454L; m_qpoints[2][2] = 0.138196601125010515L;  m_weights[2] = 0.250000000000000000L;
        m_qpoints[3][0] = 0.585410196624968454L; m_qpoints[3][1] = 0.138196601125010515L; m_qpoints[3][2] = 0.138196601125010515L;  m_weights[3] = 0.250000000000000000L;
      }
      else
      if (n == 3)
      {
        m_qpoints.resize (8);
        m_weights.resize(8);
        m_qpoints[0][0] = 0.328054696711426647L; m_qpoints[0][1] = 0.328054696711426647L; m_qpoints[0][2] = 0.328054696711426647L;  m_weights[0] = 0.138527966511862142L;
        m_qpoints[1][0] = 0.328054696711426647L; m_qpoints[1][1] = 0.328054696711426647L; m_qpoints[1][2] = 0.015835909865720058L;  m_weights[1] = 0.138527966511862142L;
        m_qpoints[2][0] = 0.328054696711426647L; m_qpoints[2][1] = 0.015835909865720058L; m_qpoints[2][2] = 0.328054696711426647L;  m_weights[2] = 0.138527966511862142L;
        m_qpoints[3][0] = 0.015835909865720058L; m_qpoints[3][1] = 0.328054696711426647L; m_qpoints[3][2] = 0.328054696711426647L;  m_weights[3] = 0.138527966511862142L;
        m_qpoints[4][0] = 0.106952273932930683L; m_qpoints[4][1] = 0.106952273932930683L; m_qpoints[4][2] = 0.106952273932930683L;  m_weights[4] = 0.111472033488137858L;
        m_qpoints[5][0] = 0.106952273932930683L; m_qpoints[5][1] = 0.106952273932930683L; m_qpoints[5][2] = 0.679143178201207952L;  m_weights[5] = 0.111472033488137858L;
        m_qpoints[6][0] = 0.106952273932930683L; m_qpoints[6][1] = 0.679143178201207952L; m_qpoints[6][2] = 0.106952273932930683L;  m_weights[6] = 0.111472033488137858L;
        m_qpoints[7][0] = 0.679143178201207952L; m_qpoints[7][1] = 0.106952273932930683L; m_qpoints[7][2] = 0.106952273932930683L;  m_weights[7] = 0.111472033488137858L;
      }
      else
      if ( (n >= 4) && (n <= 5) )
      {
        m_qpoints.resize (14);
        m_weights.resize(14);
        m_qpoints[0][0] = 0.310885919263300610L; m_qpoints[0][1] = 0.310885919263300610L; m_qpoints[0][2] = 0.310885919263300610L;  m_weights[0] = 0.112687925718015851L;
        m_qpoints[1][0] = 0.310885919263300610L; m_qpoints[1][1] = 0.310885919263300610L; m_qpoints[1][2] = 0.067342242210098171L;  m_weights[1] = 0.112687925718015851L;
        m_qpoints[2][0] = 0.310885919263300610L; m_qpoints[2][1] = 0.067342242210098171L; m_qpoints[2][2] = 0.310885919263300610L;  m_weights[2] = 0.112687925718015851L;
        m_qpoints[3][0] = 0.067342242210098171L; m_qpoints[3][1] = 0.310885919263300610L; m_qpoints[3][2] = 0.310885919263300610L;  m_weights[3] = 0.112687925718015851L;
        m_qpoints[4][0] = 0.092735250310891226L; m_qpoints[4][1] = 0.092735250310891226L; m_qpoints[4][2] = 0.092735250310891226L;  m_weights[4] = 0.073493043116361950L;
        m_qpoints[5][0] = 0.092735250310891226L; m_qpoints[5][1] = 0.092735250310891226L; m_qpoints[5][2] = 0.721794249067326321L;  m_weights[5] = 0.073493043116361950L;
        m_qpoints[6][0] = 0.092735250310891226L; m_qpoints[6][1] = 0.721794249067326321L; m_qpoints[6][2] = 0.092735250310891226L;  m_weights[6] = 0.073493043116361950L;
        m_qpoints[7][0] = 0.721794249067326321L; m_qpoints[7][1] = 0.092735250310891226L; m_qpoints[7][2] = 0.092735250310891226L;  m_weights[7] = 0.073493043116361950L;
        m_qpoints[8][0] = 0.045503704125649649L; m_qpoints[8][1] = 0.045503704125649649L; m_qpoints[8][2] = 0.454496295874350350L;  m_weights[8] = 0.042546020777081466L;
        m_qpoints[9][0] = 0.045503704125649649L; m_qpoints[9][1] = 0.454496295874350350L; m_qpoints[9][2] = 0.045503704125649649L;  m_weights[9] = 0.042546020777081466L;
        m_qpoints[10][0] = 0.045503704125649649L; m_qpoints[10][1] = 0.454496295874350350L; m_qpoints[10][2] = 0.454496295874350350L;  m_weights[10] = 0.042546020777081466L;
        m_qpoints[11][0] = 0.454496295874350350L; m_qpoints[11][1] = 0.454496295874350350L; m_qpoints[11][2] = 0.045503704125649649L;  m_weights[11] = 0.042546020777081466L;
        m_qpoints[12][0] = 0.454496295874350350L; m_qpoints[12][1] = 0.045503704125649649L; m_qpoints[12][2] = 0.454496295874350350L;  m_weights[12] = 0.042546020777081466L;
        m_qpoints[13][0] = 0.454496295874350350L; m_qpoints[13][1] = 0.045503704125649649L; m_qpoints[13][2] = 0.045503704125649649L;  m_weights[13] = 0.042546020777081466L;
      }
      else
      if (n == 6)
      {
        m_qpoints.resize (24);
        m_weights.resize(24);
        m_qpoints[0][0] = 0.214602871259152029L; m_qpoints[0][1] = 0.214602871259152029L; m_qpoints[0][2] = 0.214602871259152029L;  m_weights[0] = 0.039922750258167492L;
        m_qpoints[1][0] = 0.214602871259152029L; m_qpoints[1][1] = 0.214602871259152029L; m_qpoints[1][2] = 0.356191386222543912L;  m_weights[1] = 0.039922750258167492L;
        m_qpoints[2][0] = 0.214602871259152029L; m_qpoints[2][1] = 0.356191386222543912L; m_qpoints[2][2] = 0.214602871259152029L;  m_weights[2] = 0.039922750258167492L;
        m_qpoints[3][0] = 0.356191386222543912L; m_qpoints[3][1] = 0.214602871259152029L; m_qpoints[3][2] = 0.214602871259152029L;  m_weights[3] = 0.039922750258167492L;
        m_qpoints[4][0] = 0.040673958534611353L; m_qpoints[4][1] = 0.040673958534611353L; m_qpoints[4][2] = 0.040673958534611353L;  m_weights[4] = 0.010077211055320643L;
        m_qpoints[5][0] = 0.040673958534611353L; m_qpoints[5][1] = 0.040673958534611353L; m_qpoints[5][2] = 0.877978124396165941L;  m_weights[5] = 0.010077211055320643L;
        m_qpoints[6][0] = 0.040673958534611353L; m_qpoints[6][1] = 0.877978124396165941L; m_qpoints[6][2] = 0.040673958534611353L;  m_weights[6] = 0.010077211055320643L;
        m_qpoints[7][0] = 0.877978124396165941L; m_qpoints[7][1] = 0.040673958534611353L; m_qpoints[7][2] = 0.040673958534611353L;  m_weights[7] = 0.010077211055320643L;
        m_qpoints[8][0] = 0.322337890142275510L; m_qpoints[8][1] = 0.322337890142275510L; m_qpoints[8][2] = 0.322337890142275510L;  m_weights[8] = 0.055357181543654722L;
        m_qpoints[9][0] = 0.322337890142275510L; m_qpoints[9][1] = 0.322337890142275510L; m_qpoints[9][2] = 0.032986329573173469L;  m_weights[9] = 0.055357181543654722L;
        m_qpoints[10][0] = 0.322337890142275510L; m_qpoints[10][1] = 0.032986329573173469L; m_qpoints[10][2] = 0.322337890142275510L;  m_weights[10] = 0.055357181543654722L;
        m_qpoints[11][0] = 0.032986329573173469L; m_qpoints[11][1] = 0.322337890142275510L; m_qpoints[11][2] = 0.322337890142275510L;  m_weights[11] = 0.055357181543654722L;
        m_qpoints[12][0] = 0.063661001875017525L; m_qpoints[12][1] = 0.063661001875017525L; m_qpoints[12][2] = 0.603005664791649141L;  m_weights[12] = 0.048214285714285714L;
        m_qpoints[13][0] = 0.063661001875017525L; m_qpoints[13][1] = 0.063661001875017525L; m_qpoints[13][2] = 0.269672331458315808L;  m_weights[13] = 0.048214285714285714L;
        m_qpoints[14][0] = 0.063661001875017525L; m_qpoints[14][1] = 0.603005664791649141L; m_qpoints[14][2] = 0.063661001875017525L;  m_weights[14] = 0.048214285714285714L;
        m_qpoints[15][0] = 0.063661001875017525L; m_qpoints[15][1] = 0.603005664791649141L; m_qpoints[15][2] = 0.269672331458315808L;  m_weights[15] = 0.048214285714285714L;
        m_qpoints[16][0] = 0.063661001875017525L; m_qpoints[16][1] = 0.269672331458315808L; m_qpoints[16][2] = 0.063661001875017525L;  m_weights[16] = 0.048214285714285714L;
        m_qpoints[17][0] = 0.063661001875017525L; m_qpoints[17][1] = 0.269672331458315808L; m_qpoints[17][2] = 0.603005664791649141L;  m_weights[17] = 0.048214285714285714L;
        m_qpoints[18][0] = 0.603005664791649141L; m_qpoints[18][1] = 0.063661001875017525L; m_qpoints[18][2] = 0.063661001875017525L;  m_weights[18] = 0.048214285714285714L;
        m_qpoints[19][0] = 0.603005664791649141L; m_qpoints[19][1] = 0.063661001875017525L; m_qpoints[19][2] = 0.269672331458315808L;  m_weights[19] = 0.048214285714285714L;
        m_qpoints[20][0] = 0.603005664791649141L; m_qpoints[20][1] = 0.269672331458315808L; m_qpoints[20][2] = 0.063661001875017525L;  m_weights[20] = 0.048214285714285714L;
        m_qpoints[21][0] = 0.269672331458315808L; m_qpoints[21][1] = 0.063661001875017525L; m_qpoints[21][2] = 0.063661001875017525L;  m_weights[21] = 0.048214285714285714L;
        m_qpoints[22][0] = 0.269672331458315808L; m_qpoints[22][1] = 0.063661001875017525L; m_qpoints[22][2] = 0.603005664791649141L;  m_weights[22] = 0.048214285714285714L;
        m_qpoints[23][0] = 0.269672331458315808L; m_qpoints[23][1] = 0.603005664791649141L; m_qpoints[23][2] = 0.063661001875017525L;  m_weights[23] = 0.048214285714285714L;
      }
      else
      if (n == 7)
      {
        m_qpoints.resize (36);
        m_weights.resize(36);
        m_qpoints[0][0] = 0.040610707192945272L; m_qpoints[0][1] = 0.040610707192945272L; m_qpoints[0][2] = 0.040610707192945272L;  m_weights[0] = 0.006183415839458518L;
        m_qpoints[1][0] = 0.040610707192945272L; m_qpoints[1][1] = 0.040610707192945272L; m_qpoints[1][2] = 0.878167878421164183L;  m_weights[1] = 0.006183415839458518L;
        m_qpoints[2][0] = 0.040610707192945272L; m_qpoints[2][1] = 0.878167878421164183L; m_qpoints[2][2] = 0.040610707192945272L;  m_weights[2] = 0.006183415839458518L;
        m_qpoints[3][0] = 0.878167878421164183L; m_qpoints[3][1] = 0.040610707192945272L; m_qpoints[3][2] = 0.040610707192945272L;  m_weights[3] = 0.006183415839458518L;
        m_qpoints[4][0] = 0.178752202696498476L; m_qpoints[4][1] = 0.178752202696498476L; m_qpoints[4][2] = 0.178752202696498476L;  m_weights[4] = 0.078514650273872359L;
        m_qpoints[5][0] = 0.178752202696498476L; m_qpoints[5][1] = 0.178752202696498476L; m_qpoints[5][2] = 0.463743391910504572L;  m_weights[5] = 0.078514650273872359L;
        m_qpoints[6][0] = 0.178752202696498476L; m_qpoints[6][1] = 0.463743391910504572L; m_qpoints[6][2] = 0.178752202696498476L;  m_weights[6] = 0.078514650273872359L;
        m_qpoints[7][0] = 0.463743391910504572L; m_qpoints[7][1] = 0.178752202696498476L; m_qpoints[7][2] = 0.178752202696498476L;  m_weights[7] = 0.078514650273872359L;
        m_qpoints[8][0] = 0.324949590537337334L; m_qpoints[8][1] = 0.324949590537337334L; m_qpoints[8][2] = 0.324949590537337334L;  m_weights[8] = 0.044739577614322479L;
        m_qpoints[9][0] = 0.324949590537337334L; m_qpoints[9][1] = 0.324949590537337334L; m_qpoints[9][2] = 0.025151228387987999L;  m_weights[9] = 0.044739577614322479L;
        m_qpoints[10][0] = 0.324949590537337334L; m_qpoints[10][1] = 0.025151228387987999L; m_qpoints[10][2] = 0.324949590537337334L;  m_weights[10] = 0.044739577614322479L;
        m_qpoints[11][0] = 0.025151228387987999L; m_qpoints[11][1] = 0.324949590537337334L; m_qpoints[11][2] = 0.324949590537337334L;  m_weights[11] = 0.044739577614322479L;
        m_qpoints[12][0] = 0.134077737972161192L; m_qpoints[12][1] = 0.134077737972161192L; m_qpoints[12][2] = 0.727012507009317100L;  m_weights[12] = 0.012165144592291294L;
        m_qpoints[13][0] = 0.134077737972161192L; m_qpoints[13][1] = 0.134077737972161192L; m_qpoints[13][2] = 0.004832017046360516L;  m_weights[13] = 0.012165144592291294L;
        m_qpoints[14][0] = 0.134077737972161192L; m_qpoints[14][1] = 0.727012507009317100L; m_qpoints[14][2] = 0.134077737972161192L;  m_weights[14] = 0.012165144592291294L;
        m_qpoints[15][0] = 0.134077737972161192L; m_qpoints[15][1] = 0.727012507009317100L; m_qpoints[15][2] = 0.004832017046360516L;  m_weights[15] = 0.012165144592291294L;
        m_qpoints[16][0] = 0.134077737972161192L; m_qpoints[16][1] = 0.004832017046360516L; m_qpoints[16][2] = 0.134077737972161192L;  m_weights[16] = 0.012165144592291294L;
        m_qpoints[17][0] = 0.134077737972161192L; m_qpoints[17][1] = 0.004832017046360516L; m_qpoints[17][2] = 0.727012507009317100L;  m_weights[17] = 0.012165144592291294L;
        m_qpoints[18][0] = 0.727012507009317100L; m_qpoints[18][1] = 0.134077737972161192L; m_qpoints[18][2] = 0.134077737972161192L;  m_weights[18] = 0.012165144592291294L;
        m_qpoints[19][0] = 0.727012507009317100L; m_qpoints[19][1] = 0.134077737972161192L; m_qpoints[19][2] = 0.004832017046360516L;  m_weights[19] = 0.012165144592291294L;
        m_qpoints[20][0] = 0.727012507009317100L; m_qpoints[20][1] = 0.004832017046360516L; m_qpoints[20][2] = 0.134077737972161192L;  m_weights[20] = 0.012165144592291294L;
        m_qpoints[21][0] = 0.004832017046360516L; m_qpoints[21][1] = 0.134077737972161192L; m_qpoints[21][2] = 0.134077737972161192L;  m_weights[21] = 0.012165144592291294L;
        m_qpoints[22][0] = 0.004832017046360516L; m_qpoints[22][1] = 0.134077737972161192L; m_qpoints[22][2] = 0.727012507009317100L;  m_weights[22] = 0.012165144592291294L;
        m_qpoints[23][0] = 0.004832017046360516L; m_qpoints[23][1] = 0.727012507009317100L; m_qpoints[23][2] = 0.134077737972161192L;  m_weights[23] = 0.012165144592291294L;
        m_qpoints[24][0] = 0.056027540459728477L; m_qpoints[24][1] = 0.056027540459728477L; m_qpoints[24][2] = 0.326574099866404958L;  m_weights[24] = 0.028022307498490921L;
        m_qpoints[25][0] = 0.056027540459728477L; m_qpoints[25][1] = 0.056027540459728477L; m_qpoints[25][2] = 0.561370819214138088L;  m_weights[25] = 0.028022307498490921L;
        m_qpoints[26][0] = 0.056027540459728477L; m_qpoints[26][1] = 0.326574099866404958L; m_qpoints[26][2] = 0.056027540459728477L;  m_weights[26] = 0.028022307498490921L;
        m_qpoints[27][0] = 0.056027540459728477L; m_qpoints[27][1] = 0.326574099866404958L; m_qpoints[27][2] = 0.561370819214138088L;  m_weights[27] = 0.028022307498490921L;
        m_qpoints[28][0] = 0.056027540459728477L; m_qpoints[28][1] = 0.561370819214138088L; m_qpoints[28][2] = 0.056027540459728477L;  m_weights[28] = 0.028022307498490921L;
        m_qpoints[29][0] = 0.056027540459728477L; m_qpoints[29][1] = 0.561370819214138088L; m_qpoints[29][2] = 0.326574099866404958L;  m_weights[29] = 0.028022307498490921L;
        m_qpoints[30][0] = 0.326574099866404958L; m_qpoints[30][1] = 0.056027540459728477L; m_qpoints[30][2] = 0.056027540459728477L;  m_weights[30] = 0.028022307498490921L;
        m_qpoints[31][0] = 0.326574099866404958L; m_qpoints[31][1] = 0.056027540459728477L; m_qpoints[31][2] = 0.561370819214138088L;  m_weights[31] = 0.028022307498490921L;
        m_qpoints[32][0] = 0.326574099866404958L; m_qpoints[32][1] = 0.561370819214138088L; m_qpoints[32][2] = 0.056027540459728477L;  m_weights[32] = 0.028022307498490921L;
        m_qpoints[33][0] = 0.561370819214138088L; m_qpoints[33][1] = 0.056027540459728477L; m_qpoints[33][2] = 0.056027540459728477L;  m_weights[33] = 0.028022307498490921L;
        m_qpoints[34][0] = 0.561370819214138088L; m_qpoints[34][1] = 0.056027540459728477L; m_qpoints[34][2] = 0.326574099866404958L;  m_weights[34] = 0.028022307498490921L;
        m_qpoints[35][0] = 0.561370819214138088L; m_qpoints[35][1] = 0.326574099866404958L; m_qpoints[35][2] = 0.056027540459728477L;  m_weights[35] = 0.028022307498490921L;
      }
      else
      if (n == 8)
      {
        m_qpoints.resize (46);
        m_weights.resize(46);
        m_qpoints[0][0] = 0.039675423070389901L; m_qpoints[0][1] = 0.039675423070389901L; m_qpoints[0][2] = 0.039675423070389901L;  m_weights[0] = 0.006397147779902321L;
        m_qpoints[1][0] = 0.039675423070389901L; m_qpoints[1][1] = 0.039675423070389901L; m_qpoints[1][2] = 0.880973730788830296L;  m_weights[1] = 0.006397147779902321L;
        m_qpoints[2][0] = 0.039675423070389901L; m_qpoints[2][1] = 0.880973730788830296L; m_qpoints[2][2] = 0.039675423070389901L;  m_weights[2] = 0.006397147779902321L;
        m_qpoints[3][0] = 0.880973730788830296L; m_qpoints[3][1] = 0.039675423070389901L; m_qpoints[3][2] = 0.039675423070389901L;  m_weights[3] = 0.006397147779902321L;
        m_qpoints[4][0] = 0.314487800698096314L; m_qpoints[4][1] = 0.314487800698096314L; m_qpoints[4][2] = 0.314487800698096314L;  m_weights[4] = 0.040190448020966172L;
        m_qpoints[5][0] = 0.314487800698096314L; m_qpoints[5][1] = 0.314487800698096314L; m_qpoints[5][2] = 0.056536597905711059L;  m_weights[5] = 0.040190448020966172L;
        m_qpoints[6][0] = 0.314487800698096314L; m_qpoints[6][1] = 0.056536597905711059L; m_qpoints[6][2] = 0.314487800698096314L;  m_weights[6] = 0.040190448020966172L;
        m_qpoints[7][0] = 0.056536597905711059L; m_qpoints[7][1] = 0.314487800698096314L; m_qpoints[7][2] = 0.314487800698096314L;  m_weights[7] = 0.040190448020966172L;
        m_qpoints[8][0] = 0.101986693062703300L; m_qpoints[8][1] = 0.101986693062703300L; m_qpoints[8][2] = 0.101986693062703300L;  m_weights[8] = 0.024307975504770321L;
        m_qpoints[9][0] = 0.101986693062703300L; m_qpoints[9][1] = 0.101986693062703300L; m_qpoints[9][2] = 0.694039920811890100L;  m_weights[9] = 0.024307975504770321L;
        m_qpoints[10][0] = 0.101986693062703300L; m_qpoints[10][1] = 0.694039920811890100L; m_qpoints[10][2] = 0.101986693062703300L;  m_weights[10] = 0.024307975504770321L;
        m_qpoints[11][0] = 0.694039920811890100L; m_qpoints[11][1] = 0.101986693062703300L; m_qpoints[11][2] = 0.101986693062703300L;  m_weights[11] = 0.024307975504770321L;
        m_qpoints[12][0] = 0.184203696949191512L; m_qpoints[12][1] = 0.184203696949191512L; m_qpoints[12][2] = 0.184203696949191512L;  m_weights[12] = 0.054858892413697440L;
        m_qpoints[13][0] = 0.184203696949191512L; m_qpoints[13][1] = 0.184203696949191512L; m_qpoints[13][2] = 0.447388909152425463L;  m_weights[13] = 0.054858892413697440L;
        m_qpoints[14][0] = 0.184203696949191512L; m_qpoints[14][1] = 0.447388909152425463L; m_qpoints[14][2] = 0.184203696949191512L;  m_weights[14] = 0.054858892413697440L;
        m_qpoints[15][0] = 0.447388909152425463L; m_qpoints[15][1] = 0.184203696949191512L; m_qpoints[15][2] = 0.184203696949191512L;  m_weights[15] = 0.054858892413697440L;
        m_qpoints[16][0] = 0.063436287754539892L; m_qpoints[16][1] = 0.063436287754539892L; m_qpoints[16][2] = 0.436563712245460108L;  m_weights[16] = 0.035719612234099182L;
        m_qpoints[17][0] = 0.063436287754539892L; m_qpoints[17][1] = 0.436563712245460108L; m_qpoints[17][2] = 0.063436287754539892L;  m_weights[17] = 0.035719612234099182L;
        m_qpoints[18][0] = 0.063436287754539892L; m_qpoints[18][1] = 0.436563712245460108L; m_qpoints[18][2] = 0.436563712245460108L;  m_weights[18] = 0.035719612234099182L;
        m_qpoints[19][0] = 0.436563712245460108L; m_qpoints[19][1] = 0.436563712245460108L; m_qpoints[19][2] = 0.063436287754539892L;  m_weights[19] = 0.035719612234099182L;
        m_qpoints[20][0] = 0.436563712245460108L; m_qpoints[20][1] = 0.063436287754539892L; m_qpoints[20][2] = 0.436563712245460108L;  m_weights[20] = 0.035719612234099182L;
        m_qpoints[21][0] = 0.436563712245460108L; m_qpoints[21][1] = 0.063436287754539892L; m_qpoints[21][2] = 0.063436287754539892L;  m_weights[21] = 0.035719612234099182L;
        m_qpoints[22][0] = 0.021690162067728005L; m_qpoints[22][1] = 0.021690162067728005L; m_qpoints[22][2] = 0.719931922039465936L;  m_weights[22] = 0.007183190697852539L;
        m_qpoints[23][0] = 0.021690162067728005L; m_qpoints[23][1] = 0.021690162067728005L; m_qpoints[23][2] = 0.236687753825078055L;  m_weights[23] = 0.007183190697852539L;
        m_qpoints[24][0] = 0.021690162067728005L; m_qpoints[24][1] = 0.719931922039465936L; m_qpoints[24][2] = 0.021690162067728005L;  m_weights[24] = 0.007183190697852539L;
        m_qpoints[25][0] = 0.021690162067728005L; m_qpoints[25][1] = 0.719931922039465936L; m_qpoints[25][2] = 0.236687753825078055L;  m_weights[25] = 0.007183190697852539L;
        m_qpoints[26][0] = 0.021690162067728005L; m_qpoints[26][1] = 0.236687753825078055L; m_qpoints[26][2] = 0.021690162067728005L;  m_weights[26] = 0.007183190697852539L;
        m_qpoints[27][0] = 0.021690162067728005L; m_qpoints[27][1] = 0.236687753825078055L; m_qpoints[27][2] = 0.719931922039465936L;  m_weights[27] = 0.007183190697852539L;
        m_qpoints[28][0] = 0.719931922039465936L; m_qpoints[28][1] = 0.021690162067728005L; m_qpoints[28][2] = 0.021690162067728005L;  m_weights[28] = 0.007183190697852539L;
        m_qpoints[29][0] = 0.719931922039465936L; m_qpoints[29][1] = 0.021690162067728005L; m_qpoints[29][2] = 0.236687753825078055L;  m_weights[29] = 0.007183190697852539L;
        m_qpoints[30][0] = 0.719931922039465936L; m_qpoints[30][1] = 0.236687753825078055L; m_qpoints[30][2] = 0.021690162067728005L;  m_weights[30] = 0.007183190697852539L;
        m_qpoints[31][0] = 0.236687753825078055L; m_qpoints[31][1] = 0.021690162067728005L; m_qpoints[31][2] = 0.021690162067728005L;  m_weights[31] = 0.007183190697852539L;
        m_qpoints[32][0] = 0.236687753825078055L; m_qpoints[32][1] = 0.021690162067728005L; m_qpoints[32][2] = 0.719931922039465936L;  m_weights[32] = 0.007183190697852539L;
        m_qpoints[33][0] = 0.236687753825078055L; m_qpoints[33][1] = 0.719931922039465936L; m_qpoints[33][2] = 0.021690162067728005L;  m_weights[33] = 0.007183190697852539L;
        m_qpoints[34][0] = 0.204480080636795714L; m_qpoints[34][1] = 0.204480080636795714L; m_qpoints[34][2] = 0.580577190128809224L;  m_weights[34] = 0.016372181945319118L;
        m_qpoints[35][0] = 0.204480080636795714L; m_qpoints[35][1] = 0.204480080636795714L; m_qpoints[35][2] = 0.010462648597599347L;  m_weights[35] = 0.016372181945319118L;
        m_qpoints[36][0] = 0.204480080636795714L; m_qpoints[36][1] = 0.580577190128809224L; m_qpoints[36][2] = 0.204480080636795714L;  m_weights[36] = 0.016372181945319118L;
        m_qpoints[37][0] = 0.204480080636795714L; m_qpoints[37][1] = 0.580577190128809224L; m_qpoints[37][2] = 0.010462648597599347L;  m_weights[37] = 0.016372181945319118L;
        m_qpoints[38][0] = 0.204480080636795714L; m_qpoints[38][1] = 0.010462648597599347L; m_qpoints[38][2] = 0.204480080636795714L;  m_weights[38] = 0.016372181945319118L;
        m_qpoints[39][0] = 0.204480080636795714L; m_qpoints[39][1] = 0.010462648597599347L; m_qpoints[39][2] = 0.580577190128809224L;  m_weights[39] = 0.016372181945319118L;
        m_qpoints[40][0] = 0.580577190128809224L; m_qpoints[40][1] = 0.204480080636795714L; m_qpoints[40][2] = 0.204480080636795714L;  m_weights[40] = 0.016372181945319118L;
        m_qpoints[41][0] = 0.580577190128809224L; m_qpoints[41][1] = 0.204480080636795714L; m_qpoints[41][2] = 0.010462648597599347L;  m_weights[41] = 0.016372181945319118L;
        m_qpoints[42][0] = 0.580577190128809224L; m_qpoints[42][1] = 0.010462648597599347L; m_qpoints[42][2] = 0.204480080636795714L;  m_weights[42] = 0.016372181945319118L;
        m_qpoints[43][0] = 0.010462648597599347L; m_qpoints[43][1] = 0.204480080636795714L; m_qpoints[43][2] = 0.204480080636795714L;  m_weights[43] = 0.016372181945319118L;
        m_qpoints[44][0] = 0.010462648597599347L; m_qpoints[44][1] = 0.204480080636795714L; m_qpoints[44][2] = 0.580577190128809224L;  m_weights[44] = 0.016372181945319118L;
        m_qpoints[45][0] = 0.010462648597599347L; m_qpoints[45][1] = 0.580577190128809224L; m_qpoints[45][2] = 0.204480080636795714L;  m_weights[45] = 0.016372181945319118L;
      }
      else
      {
        ALELIB_CHECK(false, "invalid or not supported quadrature order", std::invalid_argument);
      }
      for (int i = 0; i < (int)m_weights.size(); ++i)
        m_weights[i] /= 6.0L;      
    }
    break;


    default:
      throw;
  }





}



} // end namespace alelib

